Skip to content

[quality] test: unit coverage for scripts/compose-e2e-image.sh (new tests/unit/test_compose_e2e_image.py) - #774

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-compose-e2e-image
Open

[quality] test: unit coverage for scripts/compose-e2e-image.sh (new tests/unit/test_compose_e2e_image.py)#774
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-compose-e2e-image

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/unit/test_compose_e2e_image.py — 18 behavioural tests for scripts/compose-e2e-image.sh, which previously had zero coverage.

Claimed ground (for open-PR disjointness checks)

  • Adds: tests/unit/test_compose_e2e_image.py (new file, only file in the diff)
  • Covers: scripts/compose-e2e-image.sh only
  • Touches no production code, no shared module, no other test file.

Disjoint from every open testsuite PR: #766 (generate_skill_index.py, update_coverage_snapshot.py), #768 (offline_boot_steps.py, sudo_rs_steps.py, bctl_steps.py, update_failure_steps.py), #765 (environment.py quarantine contract), #773 (SSH transport / ssh_config.py), #771 (Containerfile.runner), #751 (screenshot_steps.py), #757 (input-remapper QEMU).

Why this script matters

compose-e2e-image.sh builds the E2E overlay layer FROM the image under test and pushes the composed ref that every suite job boots. It runs only inside e2e.yml, so a regression in it surfaces as a red E2E lane that reads like a product regression rather than a tooling bug.

What is asserted

The script is executed in a hermetic sandbox (fake podman/sudo shims on PATH, throwaway E2E_OVERLAY_DIR, no registry contact), and assertions are on observed argv/exit codes rather than source text:

  • argument-count guards exit 2 without invoking podman
  • a missing overlay Containerfile exits 1 before any build
  • --build-arg carries the base ref; -t carries the composed ref
  • -f and the build context both resolve to the overlay directory
  • build strictly precedes push; a failed build never reaches the registry
  • a failed push is not swallowed into a success
  • the composed ref is the final stdout line e2e.yml consumes
  • the PODMAN default expands as words to sudo podman (root image store)
  • refs containing shell metacharacters pass through unexpanded

Verification

python3 -m pytest tests/unit/test_compose_e2e_image.py -q   # 18 passed

Mutation-checked — each of these breaks at least one test: self-referential BASE_IMAGE, dropping set -e, removing the final echo, dropping sudo from the PODMAN default, loosening $# -ne 2.

Full tests/unit/ run is unchanged apart from the new file (pre-existing failures/errors in this environment come from missing behave/selenium, untouched by this PR).


Filed by quality agent (hold-gated mode). Human review required — do not merge automatically.

— hive: agent=quality backend=copilot model=claude-opus-5

scripts/compose-e2e-image.sh builds the E2E overlay layer FROM the image
under test and pushes the composed ref that every suite job boots. It had
no test of any kind: it runs only inside e2e.yml, so a regression in it
surfaces as a red E2E lane that reads like a product regression.

Adds tests/unit/test_compose_e2e_image.py, which executes the script in a
hermetic sandbox (fake podman/sudo shims on PATH, throwaway
E2E_OVERLAY_DIR, no registry contact) and asserts observed behaviour
rather than source text:

- argument-count guards exit 2 without invoking podman
- a missing overlay Containerfile exits 1 before any build
- --build-arg carries the base ref, -t carries the composed ref
- -f and the build context both resolve to the overlay directory
- build strictly precedes push; a failed build never reaches the registry
- a failed push is not swallowed
- the composed ref is the final stdout line e2e.yml consumes
- the PODMAN default expands as words to 'sudo podman'
- refs containing shell metacharacters are passed through unexpanded

Verified by mutation: self-referential BASE_IMAGE, dropping set -e,
removing the final echo, dropping sudo from the PODMAN default, and
loosening the argument-count check are each caught by a failing test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
@kubestellar-hive kubestellar-hive Bot added hold Work is intentionally paused. quality testing agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-projectbluefin-knuckle-gjvq Approved by a Hive merger/owner for auto-merge on green CI labels Aug 30, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.39024% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tests/unit/test_compose_e2e_image.py 99.39% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-projectbluefin-knuckle-gjvq Approved by a Hive merger/owner for auto-merge on green CI hold Work is intentionally paused. quality testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant